// 开发环境
const path = require('path')
const webpack = require('webpack')
const common = require('./webpack.common.js')
const { merge } = require('webpack-merge')

module.exports = merge(common, {
    mode: 'development',
    devtool: 'cheap-module-source-map',

    devServer: {
        hot: true,
        inline: true,
        contentBase: ['./public'], // 静态资源访问目录
        port: 3000,
        // 代理设置
        // proxy: {
        //     '/api':{
        //         target: 'https://api.github.com',
        //         pathRewrite: {
        //             '^api': ''
        //         },
        //         changeOrigin: true
        //     }
        // }
    },
    plugins: [
        new webpack.DefinePlugin({
            APP_ENV: 'dev',
            BASE_URL: '"./"',
        }),
        // 启动HMR
        new webpack.HotModuleReplacementPlugin()
    ],
    
})
